From: kfraser@localhost.localdomain Date: Wed, 25 Oct 2006 14:17:40 +0000 (+0100) Subject: [XEN] Clean up NUMA stuff and disable by default ('numa=on' enables it). X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15584^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=1213fabf9b03074097eccc60fd24a85171e47000;p=xen.git [XEN] Clean up NUMA stuff and disable by default ('numa=on' enables it). Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index 86bff703f3..d332320af6 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -12,10 +12,12 @@ #include #include #include - -#include +#include #include +static int numa_setup(char *s); +custom_param("numa", numa_setup); + #ifndef Dprintk #define Dprintk(x...) #endif @@ -28,7 +30,7 @@ struct node_data node_data[MAX_NUMNODES]; int memnode_shift; u8 memnodemap[NODEMAPSIZE]; -unsigned int cpu_to_node[NR_CPUS] __read_mostly = { +unsigned char cpu_to_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { @@ -38,7 +40,8 @@ cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; nodemask_t node_online_map = { { [0] = 1UL } }; -int numa_off __initdata; +/* Default NUMA to off for now. acpi=on required to enable it. */ +int numa_off __initdata = 1; int acpi_numa __initdata; @@ -70,7 +73,7 @@ populate_memnodemap(const struct node *nodes, int numnodes, int shift) if (memnodemap[addr >> shift] != 0xff) return -1; memnodemap[addr >> shift] = i; - addr += (1UL << shift); + addr += (1UL << shift); } while (addr < end); res = 1; } @@ -133,8 +136,7 @@ void __init numa_init_array(void) } #ifdef CONFIG_NUMA_EMU -/* default to faking a single node as fallback for non-NUMA hardware */ -int numa_fake __initdata = 1; +static int numa_fake __initdata = 0; /* Numa emulation */ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) @@ -160,9 +162,9 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) sz = (end_pfn<> 20); + i, + nodes[i].start, nodes[i].end, + (nodes[i].end - nodes[i].start) >> 20); node_set_online(i); } memnode_shift = compute_hash_shift(nodes, numa_fake); @@ -182,16 +184,15 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) { int i; +#ifdef CONFIG_NUMA_EMU + if (numa_fake && !numa_emulation(start_pfn, end_pfn)) + return; +#endif + #ifdef CONFIG_ACPI_NUMA if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT)) - return; -#endif - -#ifdef CONFIG_NUMA_EMU - /* fake a numa node for non-numa hardware */ - if (numa_fake && !numa_emulation(start_pfn, end_pfn)) - return; + return; #endif printk(KERN_INFO "%s\n", @@ -200,7 +201,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) printk(KERN_INFO "Faking a node at %016lx-%016lx\n", start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT); - /* setup dummy node covering all memory */ + /* setup dummy node covering all memory */ memnode_shift = 63; memnodemap[0] = 0; nodes_clear(node_online_map); @@ -222,20 +223,25 @@ void __cpuinit numa_set_node(int cpu, int node) } /* [numa=off] */ -__init int numa_setup(char *opt) +static __init int numa_setup(char *opt) { if (!strncmp(opt,"off",3)) numa_off = 1; + if (!strncmp(opt,"on",2)) + numa_off = 0; #ifdef CONFIG_NUMA_EMU if(!strncmp(opt, "fake=", 5)) { + numa_off = 0; numa_fake = simple_strtoul(opt+5,NULL,0); ; if (numa_fake >= MAX_NUMNODES) numa_fake = MAX_NUMNODES; } #endif #ifdef CONFIG_ACPI_NUMA - if (!strncmp(opt,"noacpi",6)) - acpi_numa = -1; + if (!strncmp(opt,"noacpi",6)) { + numa_off = 0; + acpi_numa = -1; + } #endif return 1; } diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 03da8af41c..15c42b133c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -26,7 +26,6 @@ #include #include #include -#include #include extern void dmi_scan_machine(void); @@ -63,9 +62,6 @@ boolean_param("watchdog", opt_watchdog); static void parse_acpi_param(char *s); custom_param("acpi", parse_acpi_param); -extern int numa_setup(char *s); -custom_param("numa", numa_setup); - /* **** Linux config option: propagated to domain0. */ /* acpi_skip_timer_override: Skip IRQ0 overrides. */ extern int acpi_skip_timer_override; @@ -265,16 +261,16 @@ static void __init init_idle_domain(void) static void srat_detect_node(int cpu) { - unsigned node; - u8 apicid = x86_cpu_to_apicid[cpu]; + unsigned node; + u8 apicid = x86_cpu_to_apicid[cpu]; - node = apicid_to_node[apicid]; - if (node == NUMA_NO_NODE) - node = 0; - numa_set_node(cpu, node); + node = apicid_to_node[apicid]; + if ( node == NUMA_NO_NODE ) + node = 0; + numa_set_node(cpu, node); - if (acpi_numa > 0) - printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node); + if ( acpi_numa > 0 ) + printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node); } void __init __start_xen(multiboot_info_t *mbi) @@ -617,9 +613,9 @@ void __init __start_xen(multiboot_info_t *mbi) if ( !cpu_online(i) ) __cpu_up(i); - /* setup cpu_to_node[] */ + /* Set up cpu_to_node[]. */ srat_detect_node(i); - /* setup node_to_cpumask based on cpu_to_node[] */ + /* Set up node_to_cpumask based on cpu_to_node[]. */ numa_add_cpu(i); } diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index b971069cf2..f7d8712563 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index dfa85b2539..ea462e222b 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -11,22 +11,12 @@ * Adapted for Xen: Ryan Harper */ -#if 0 -#include -#include -#include -#include -#include -#include -#include -#endif #include #include #include #include #include - -#include +#include #include static struct acpi_table_slit *acpi_slit; diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index de898d2f78..f4a1adc274 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -34,9 +34,9 @@ #include #include #include +#include +#include #include -#include -#include /* * Comma-separated list of hexadecimal page numbers containing bad bytes. @@ -702,10 +702,8 @@ inline struct page_info *alloc_domheap_pages( struct domain *d, unsigned int order, unsigned int flags) { return __alloc_domheap_pages(d, smp_processor_id(), order, flags); - } - void free_domheap_pages(struct page_info *pg, unsigned int order) { int i, drop_dom_ref; diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h index c6dd5b2261..227f76325c 100644 --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -159,6 +159,7 @@ static inline void acpi_noirq_set(void) { acpi_noirq = 1; } static inline int acpi_irq_balance_set(char *str) { return 0; } extern int acpi_scan_nodes(u64 start, u64 end); extern int acpi_numa; +#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) #ifdef CONFIG_ACPI_SLEEP diff --git a/xen/include/asm-x86/numa.h b/xen/include/asm-x86/numa.h index a0db3cd272..caa6491c96 100644 --- a/xen/include/asm-x86/numa.h +++ b/xen/include/asm-x86/numa.h @@ -1,10 +1,17 @@ #ifndef _ASM_X8664_NUMA_H #define _ASM_X8664_NUMA_H 1 -#include -#include -#include -#include +#include + +#define NODES_SHIFT 6 + +extern unsigned char cpu_to_node[]; +extern cpumask_t node_to_cpumask[]; + +#define cpu_to_node(cpu) (cpu_to_node[cpu]) +#define parent_node(node) (node) +#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) +#define node_to_cpumask(node) (node_to_cpumask[node]) struct node { u64 start,end; @@ -37,6 +44,12 @@ static inline void clear_node_cpumask(int cpu) extern int memnode_shift; extern u8 memnodemap[NODEMAPSIZE]; +struct node_data { + unsigned long node_start_pfn; + unsigned long node_spanned_pages; + unsigned int node_id; +}; + extern struct node_data node_data[]; static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) diff --git a/xen/include/asm-x86/numnodes.h b/xen/include/asm-x86/numnodes.h deleted file mode 100644 index 92fadea5a8..0000000000 --- a/xen/include/asm-x86/numnodes.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _ASM_MAX_NUMNODES_H -#define _ASM_MAX_NUMNODES_H - -#include - -#if defined(__i386__) -#ifdef CONFIG_X86_NUMAQ - -/* Max 16 Nodes */ -#define NODES_SHIFT 4 - -#elif defined(CONFIG_ACPI_SRAT) - -/* Max 8 Nodes */ -#define NODES_SHIFT 3 - -#endif /* CONFIG_X86_NUMAQ */ - - -#endif /* __i386__ */ - -#if defined(CONFIG_NUMA) && defined(__x86_64__) -#define NODES_SHIFT 6 -#endif /* __x86_64__ */ - -#endif /* _ASM_MAX_NUMNODES_H */ diff --git a/xen/include/asm-x86/topology.h b/xen/include/asm-x86/topology.h deleted file mode 100644 index 0a38cd0792..0000000000 --- a/xen/include/asm-x86/topology.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2006, IBM Corp. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Ryan Harper - */ - -#ifndef _ASM_X86_TOPOLOGY_H -#define _ASM_X86_TOPOLOGY_H - -#include -#include - -extern cpumask_t cpu_online_map; - -extern unsigned int cpu_to_node[]; -extern cpumask_t node_to_cpumask[]; - -#define cpu_to_node(cpu) (cpu_to_node[cpu]) -#define parent_node(node) (node) -#define node_to_first_cpu(node) (__ffs(node_to_cpumask[node])) -#define node_to_cpumask(node) (node_to_cpumask[node]) - -#endif /* _ASM_X86_TOPOLOGY_H */ diff --git a/xen/include/xen/nodemask.h b/xen/include/xen/nodemask.h index b4a882e482..30ed6f4524 100644 --- a/xen/include/xen/nodemask.h +++ b/xen/include/xen/nodemask.h @@ -72,10 +72,6 @@ * way we do the other calls. */ -#if 0 -#include -#include -#endif #include #include #include diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h index 30afceb52f..9585fc9c48 100644 --- a/xen/include/xen/numa.h +++ b/xen/include/xen/numa.h @@ -2,34 +2,12 @@ #define _XEN_NUMA_H #include - -#ifdef CONFIG_DISCONTIGMEM -#include -#endif +#include #ifndef NODES_SHIFT #define NODES_SHIFT 0 #endif #define MAX_NUMNODES (1 << NODES_SHIFT) -#define NUMA_NO_NODE 0xff - -#define MAX_PXM_DOMAINS 256 /* 1 byte and no promises about values */ -#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) -#define MAX_CHUNKS_PER_NODE 4 -#define MAXCHUNKS (MAX_CHUNKS_PER_NODE * MAX_NUMNODES) - -/* needed for drivers/acpi/numa.c */ -#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) - -extern unsigned int cpu_to_node[]; -#include -extern cpumask_t node_to_cpumask[]; - -typedef struct node_data { - unsigned long node_start_pfn; - unsigned long node_spanned_pages; - unsigned int node_id; -} node_data_t; #endif /* _XEN_NUMA_H */ diff --git a/xen/include/xen/topology.h b/xen/include/xen/topology.h deleted file mode 100644 index e836bf132f..0000000000 --- a/xen/include/xen/topology.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2006, IBM Corp. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#ifndef _XEN_TOPOLOGY_H -#define _XEN_TOPOLOGY_H - -#include - -#endif /* _XEN_TOPOLOGY_H */